package com.share.service.sysmgr;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.share.bean.sysmgr.BackTreeMenu;
import com.share.commons.base.query.BaseQuery;
import com.share.dao.sysmgr.BackTreeMenuDao;
import com.share.web.formbean.sysmgr.BackTreeMenuForm;

/**
 * 说明：后台管理树状菜单Service实现
 * <br/>作者：杨浩泉
 * <br/>日期：2010-8-10
 */
@Service
public class BackTreeMenuManagerImpl implements BackTreeMenuManager{

	@Resource
	private BackTreeMenuDao treeDao ;
	
	@Override
	public void deleteBackTreeMenuManager(BackTreeMenu tree) throws Exception {
		this.treeDao.deleteBackTreeMenuDao(tree) ;
		
	}

	@Override
	public List<BackTreeMenu> findBackTreeMenuManager(BackTreeMenu tree,BackTreeMenuForm treeform) throws Exception {
		
		String hql = "select o from BackTreeMenu o" ;
		StringBuffer whereHQL = new StringBuffer() ; ;
		List<Object> param = new ArrayList<Object>() ;
		LinkedHashMap<String,String> orderby = new LinkedHashMap<String,String>() ;
		
		orderby.put("btm_sort",BaseQuery.DESC) ;
		
		return this.treeDao.findBackTreeMenuDao(hql, whereHQL.toString(), param, orderby) ;
	}

	@Override
	public BackTreeMenu loadBackTreeMenuManager(int id) throws Exception {
		
		return this.treeDao.loadBackTreeMenuDao(id) ;
	}

	@Override
	public void saveBackTreeMenuManager(BackTreeMenu tree) throws Exception {
		this.treeDao.saveBackTreeMenuDao(tree) ;
	}

	@Override
	public void updateBackTreeMenuManager(BackTreeMenu tree) throws Exception {
		this.treeDao.updateBackTreeMenuDao(tree) ;
		
	}
	
}
